<template>
  <div class="order">
    <orderForm v-if="orderInfo" :data="orderInfo" @setTotalPrice="setPrice" />
    <orderAside v-if="orderInfo" :data="orderInfo" :totalPrice="totalPrice" />
  </div>
</template>

<script>
import orderForm from "@/components/air/orderForm";
import orderAside from "@/components/air/orderAside";
export default {
  components: {
    orderForm,
    orderAside,
  },
  data() {
    return {
      orderInfo: null,
      totalPrice: 0,
    };
  },
  //可以进行seo优化，这只做title变化
  head() {
    return {
      title: "机票预定",
    };
  },
  created() {
    this.getOrder();
  },
  methods: {
    //订单信息
    getOrder() {
      var { id, seat_xid } = this.$route.query;
      this.$axios({
        url: "/airs/" + id,
        params: {
          seat_xid,
        },
      }).then((res) => {
        this.orderInfo = res.data;
      });
    },
    setPrice(val) {
      this.totalPrice = val;
    },
  },
};
</script>

<style lang="less" scoped>
.order {
  width: 1000px;
  margin: 20px auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
</style>